<html>
<head><meta charset="utf-8"><title>debugging infinite loops in the compiler · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html">debugging infinite loops in the compiler</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212499703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212499703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212499703">(Oct 06 2020 at 23:46)</a>:</h4>
<p>Hi all. Was hoping someone might be able to help me. I've made some changes locally to rustc. Rebased, and now a couple tests aren't finishing. So I think maybe an infinite loop or something was introduced somewhere. The problem is I don't really know where, since I've made significant changes in a few places. What's the best way to debug this?</p>



<a name="212500050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212500050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212500050">(Oct 06 2020 at 23:50)</a>:</h4>
<p>I use printf debugging <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="212500126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212500126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212500126">(Oct 06 2020 at 23:50)</a>:</h4>
<p>you could try setting <code>debug = true</code>, but that won't give you local variables, and <code>debuginfo = 2</code>, which does, takes like 10 minutes longer to compile</p>



<a name="212501870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212501870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212501870">(Oct 07 2020 at 00:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/debugging.20infinite.20loops.20in.20the.20compiler/near/212500050">said</a>:</p>
<blockquote>
<p>I use printf debugging <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>
</blockquote>
<p>My favorite kind of debugging <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="212503367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212503367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212503367">(Oct 07 2020 at 00:37)</a>:</h4>
<p>Well, if I had any idea where it might looping, that would be a good option</p>



<a name="212503412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212503412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212503412">(Oct 07 2020 at 00:38)</a>:</h4>
<p>but it's literally just...a couple tests aren't finishing and I don't know why</p>



<a name="212503531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212503531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212503531">(Oct 07 2020 at 00:40)</a>:</h4>
<p>ah hmm</p>



<a name="212503537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212503537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212503537">(Oct 07 2020 at 00:41)</a>:</h4>
<p>maybe run gdb and just ctrl+c after it's been running a while? <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="212503917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212503917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212503917">(Oct 07 2020 at 00:49)</a>:</h4>
<p>Any guides to using gdb with the compiler?</p>



<a name="212503920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212503920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212503920">(Oct 07 2020 at 00:49)</a>:</h4>
<p>For tests</p>



<a name="212503953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212503953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212503953">(Oct 07 2020 at 00:50)</a>:</h4>
<p>(Also never used gdb)</p>



<a name="212503984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212503984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212503984">(Oct 07 2020 at 00:50)</a>:</h4>
<p>for something this simple just <code>gdb rustc</code>, <code>run filename.rs</code>, and then ctrl+C after it goes for a whiel</p>



<a name="212505322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212505322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212505322">(Oct 07 2020 at 01:15)</a>:</h4>
<div class="codehilite"><pre><span></span><code>(gdb) run src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs
Starting program: /home/hueyj/temp/rust/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs
[Thread debugging using libthread_db enabled]
Using host libthread_db library &quot;/lib/x86_64-linux-gnu/libthread_db.so.1&quot;.
[New Thread 0x7fffed23c700 (LWP 42521)]
^C
Thread 1 &quot;rustc&quot; received signal SIGINT, Interrupt.
0x00007fffedb4998d in pthread_join (threadid=140737171932928, thread_return=0x0) at pthread_join.c:90
90      pthread_join.c: No such file or directory.
</code></pre></div>



<a name="212505326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212505326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212505326">(Oct 07 2020 at 01:15)</a>:</h4>
<p>That doesn't seem helpful</p>



<a name="212505680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212505680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212505680">(Oct 07 2020 at 01:22)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> <code>where</code></p>



<a name="212505889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212505889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212505889">(Oct 07 2020 at 01:26)</a>:</h4>
<p>ooh</p>



<a name="212505935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212505935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212505935">(Oct 07 2020 at 01:27)</a>:</h4>
<div class="codehilite"><pre><span></span><code>(gdb) where
#0  0x00007fffedb4998d in pthread_join (threadid=140737171932928, thread_return=0x0) at pthread_join.c:90
#1  0x00007fffee7b232d in std::sys::unix::thread::Thread::join () at library/std/src/sys/unix/thread.rs:191
#2  0x00007fffef50e4e2 in std::thread::JoinInner&lt;T&gt;::join () at /home/hueyj/temp/rust/rust/library/std/src/thread/mod.rs:1234
#3  std::thread::JoinHandle&lt;T&gt;::join () at /home/hueyj/temp/rust/rust/library/std/src/thread/mod.rs:1363
#4  0x00007fffef51943c in rustc_interface::util::scoped_thread () at /home/hueyj/temp/rust/rust/compiler/rustc_interface/src/util.rs:136
#5  rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals () at /home/hueyj/temp/rust/rust/compiler/rustc_interface/src/util.rs:166
#6  0x00007fffef512d81 in rustc_interface::interface::run_compiler () at /home/hueyj/temp/rust/rust/compiler/rustc_interface/src/interface.rs:208
#7  0x00007fffef4c1b7f in rustc_driver::run_compiler () at compiler/rustc_driver/src/lib.rs:271
#8  0x00007fffef4e7c89 in rustc_driver::main::{{closure}} () at compiler/rustc_driver/src/lib.rs:1288
#9  &lt;std::panic::AssertUnwindSafe&lt;F&gt; as core::ops::function::FnOnce&lt;()&gt;&gt;::call_once () at /home/hueyj/temp/rust/rust/library/std/src/panic.rs:308
#10 0x00007fffef633b6f in std::panicking::try::do_call () at /home/hueyj/temp/rust/rust/library/std/src/panicking.rs:381
#11 std::panicking::try () at /home/hueyj/temp/rust/rust/library/std/src/panicking.rs:345
#12 0x00007fffef529a42 in std::panic::catch_unwind () at /home/hueyj/temp/rust/rust/library/std/src/panic.rs:382
#13 rustc_driver::catch_fatal_errors () at compiler/rustc_driver/src/lib.rs:1136
--Type &lt;RET&gt; for more, q to quit, c to continue without paging--
#14 rustc_driver::catch_with_exit_code () at compiler/rustc_driver/src/lib.rs:1148
#15 0x00007fffef4c7b01 in rustc_driver::main () at compiler/rustc_driver/src/lib.rs:1276
#16 0x00005555555548fd in rustc_main::main () at compiler/rustc/src/main.rs:30
</code></pre></div>



<a name="212505981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212505981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212505981">(Oct 07 2020 at 01:28)</a>:</h4>
<p>wrong thread, this one isn't doing anything interesting</p>



<a name="212505983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212505983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212505983">(Oct 07 2020 at 01:28)</a>:</h4>
<p>try <code>thread apply all where</code></p>



<a name="212506025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212506025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212506025">(Oct 07 2020 at 01:29)</a>:</h4>
<div class="codehilite"><pre><span></span><code>Thread 2 (Thread 0x7fffed23c700 (LWP 42521)):
#0  0x00007ffff4d4b035 in rustc_middle::ty::structural_impls::&lt;impl rustc_middle::ty::fold::TypeFoldable for &amp;rustc_middle::ty::TyS&gt;::super_visit_with ()
    at compiler/rustc_middle/src/ty/structural_impls.rs:982
#1  0x00007ffff4a7d249 in &lt;rustc_middle::ty::fold::BoundVarsCollector as rustc_middle::ty::fold::TypeVisitor&gt;::visit_ty ()
    at compiler/rustc_middle/src/ty/fold.rs:766
</code></pre></div>



<a name="212506027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212506027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212506027">(Oct 07 2020 at 01:29)</a>:</h4>
<p>that one looks right</p>



<a name="212506031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212506031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212506031">(Oct 07 2020 at 01:29)</a>:</h4>
<p>Thanks for your help :)</p>



<a name="212506034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212506034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212506034">(Oct 07 2020 at 01:30)</a>:</h4>
<p>no problem :)</p>



<a name="212512754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212512754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212512754">(Oct 07 2020 at 03:56)</a>:</h4>
<p>I think that <a href="https://github.com/rust-lang/rust/pull/76843">https://github.com/rust-lang/rust/pull/76843</a> is the cause of my problems</p>



<a name="212512763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212512763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212512763">(Oct 07 2020 at 03:57)</a>:</h4>
<p>possibly</p>



<a name="212513271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debugging%20infinite%20loops%20in%20the%20compiler/near/212513271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debugging.20infinite.20loops.20in.20the.20compiler.html#212513271">(Oct 07 2020 at 04:06)</a>:</h4>
<p>actually, probably <a href="https://github.com/rust-lang/rust/pull/72412">https://github.com/rust-lang/rust/pull/72412</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>